package com.weixing.mall.provider.controller.front;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoNeedAccess;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.model.enums.AppointmentEunm;
import com.weixing.mall.provider.model.enums.ads.PlatformTypeEunm;
import com.weixing.mall.provider.model.query.LeaderAdsQuery;
import com.weixing.mall.provider.service.ILeaderReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("front/leaderShow")
@Api(value = "前端：领导看板",tags = "前端：领导看板")
public class FrontLeaderShowController extends BaseController {
    @Autowired
    private ILeaderReportService leaderReportService;


    @ApiOperation("110广告报表-广告统计")
    @GetMapping("ads/getReport")
    public Result getAdsReport(LeaderAdsQuery lsq){
        if(lsq.getQueryType() == null){
            return ResultUtil.error("未匹配到查询结果,请检查查询类型参数");
        }
        //已收款截点
        //lsq.setStatus(AppointmentEunm.STATUS7.getValue());
        //又一版需求  按已收款 已排版 已投放
        List<Integer> statusList = new ArrayList<>();
        statusList.add(AppointmentEunm.STATUS7.getValue());
        statusList.add(AppointmentEunm.STATUS8.getValue());
        statusList.add(AppointmentEunm.STATUS9.getValue());
        lsq.setStatusList(statusList);

        if(lsq.getQueryType() == 1){//个人
            return ResultUtil.success(leaderReportService.personalAdsReport(lsq));
        }else if(lsq.getQueryType() == 2){//团队
            return ResultUtil.success(leaderReportService.teamAdsReport(lsq));
        }
        return ResultUtil.error("未匹配到查询结果,请检查查询类型参数");
    }

    @ApiOperation("110广告报表-广告统计列表")
    @GetMapping("ads/getReportlist")
    @NoNeedAccess
    public Result getAdsReportlist(LeaderAdsQuery lsq){
        if(lsq.getQueryType() == null){
            return ResultUtil.error("未匹配到查询结果,请检查查询类型参数");
        }
        //已收款截点
        //lsq.setStatus(AppointmentEunm.STATUS7.getValue());
        //又一版需求  按已收款 已排版 已投放
        List<Integer> statusList = new ArrayList<>();
        statusList.add(AppointmentEunm.STATUS7.getValue());
        statusList.add(AppointmentEunm.STATUS8.getValue());
        statusList.add(AppointmentEunm.STATUS9.getValue());
        lsq.setStatusList(statusList);
        if(lsq.getQueryType() == 1){//个人
            return ResultUtil.success(leaderReportService.personalAdsReportList(initMpPage(),lsq));
        }else if(lsq.getQueryType() == 2){//团队
            return ResultUtil.success(leaderReportService.teamAdsReportList(initMpPage(),lsq));
        }
        return ResultUtil.error("未匹配到查询结果,请检查查询类型参数");
    }
    @ApiOperation("110广告报表-广告个人列表")
    @GetMapping("ads/getReportPresonlist")
    @NoNeedAccess
    public Result getReportPresonlist(LeaderAdsQuery lsq){
        List<Integer> statusList = new ArrayList<>();
        statusList.add(AppointmentEunm.STATUS7.getValue());
        statusList.add(AppointmentEunm.STATUS8.getValue());
        statusList.add(AppointmentEunm.STATUS9.getValue());
        lsq.setStatusList(statusList);
        return ResultUtil.success(leaderReportService.getReportPresonlist(initMpPage(),lsq));

    }
    @ApiOperation("110广告报表-媒体类型")
    @GetMapping("ads/getPlatformTypet")
    public Result getPlatformTypet(){
        return ResultUtil.success(PlatformTypeEunm.values());
    }
}

